import java.util.Scanner;

public class demo7 {
    public static void main(String[] args) {
        while (true){
            System.out.println(outTrue());
        }
    }
    public static boolean outTrue(){
        Scanner scanner = new Scanner(System.in);
        String str = scanner.nextLine();
        int left = 0;
        int right = str.length()-1;
        int cur = 1;
        while (left <= right){
            if (str.charAt(left) == str.charAt(right)){
                left++;
                right--;
            }else if(cur == 1){
                if (str.charAt(left+1) == str.charAt(right)){
                    left += 2;
                    right--;
                    cur = 0;
                } else if (str.charAt(left) == str.charAt(right-1)) {
                    left++;
                    right -= 2;
                    cur = 0;
                }else {
                    return false;
                }
            }else {
                return false;
            }
        }
        return true;
    }
}
